<template>
  <div>
    <ol>
       <li v-for="(v, i) in newsList"
       :key="i+ '-label'"
       @click="getNewsMessage(v)"
       >
       {{v.title}}
       </li>
       <li v-for="(v, i) in newsList" :key="i">
       <router-link :to="{ name:'News2',query: { id: v.id } }">
       {{v.title}}
       </router-link>
       </li>
    </ol>
     <h1>{{news.message}}</h1>
     <h1>{{newsInfo}}</h1>

  </div>
</template>

<script>
  export default {
    name: "News2",
    data() {
      return {
        newsList: [
          {id: 1, title: "大连新闻", message: "大连好"},
          {id: 2, title: "辽宁新闻", message: "沈阳下雪了"},
          {id: 3, title: "北京新闻", message: "北京开会了"}
        ],
        news: {},
        newsInfo:""
      };
    },

    methods: {
      getNewsMessage(v) {
        this.news = v
      },

    },
  };
</script>

<style scoped></style>
